<%
  url_options = params_for(:action => :export)
  export_config = active_scaffold_config.export
-%>

<%= form_tag url_for(url_options)%>
<h4><%=as_(:columns_to_export)%></h4>
<div class="columns checkbox-list"> 
<% export_config.columns.each do |column| -%>
  <div class="column checkbox-wrapper">
    <%= content_tag(:label, check_box_tag("export_columns[#{column.name}]", 1, !export_config.default_deselected_columns.include?(column.name)) + "#{column.label}") %>
  </div>
<% end -%>  
</div>
<div class="separator"></div>

<h5><%=as_(:options)%> (<%= link_to as_(:show), "javascript:toggle('options-checkbox-list');" %>)</h5>
<div id="options-checkbox-list" class="options checkbox-list" style="display:none;">
  <div class="option checkbox-wrapper">
    <%= content_tag(:label, check_box_tag('skip_header', 1, export_config.default_skip_header) + " #{as_(:omit_header)}") %>
  </div>
  <div class="option checkbox-wrapper">
    <%= content_tag(:label, text_field_tag('delimiter', export_config.default_delimiter, :size => 1, :maxlength => 1) + " #{as_(:delimiter)}") %>
  </div>
  <div class="separator"></div>
  <div class="option checkbox-wrapper">
    <%= content_tag(:label, radio_button_tag('full_download', false, !export_config.default_full_download) + " #{as_(:this_page)}") if export_config.allow_full_download %>
  </div>
  <div class="option checkbox-wrapper">
    <%= content_tag(:label, radio_button_tag('full_download', true, export_config.default_full_download) + " #{as_(:all_pages)}") if export_config.allow_full_download %>
  </div>
  <div class="separator"></div>
  <h5><%=as_(:file_format)%></h5>
  <div class="option checkbox-wrapper">
	<%= content_tag(:label, radio_button_tag('format', "Excel", true) + " #{as_('Excel')}") %>
  </div>
  <div class="option checkbox-wrapper">
	<%= content_tag(:label, radio_button_tag('format', "EnhancedXMLToFile", false) + " #{as_('Enhanced XML To File')}") %>
  </div>
  <div class="option checkbox-wrapper">
	<%= content_tag(:label, radio_button_tag('format', "EnhancedXML", false) + " #{as_('Enhanced XML')}") %>
  </div>
  <div class="option checkbox-wrapper">
	<%= content_tag(:label, radio_button_tag('format', "RawXML", false) + " #{as_('Raw XML')}") %>
  </div>
  <div class="option checkbox-wrapper">
	<%= content_tag(:label, radio_button_tag('format', "CSV", false) + " #{as_('CSV')}") %>
  </div>
  <div class="option checkbox-wrapper">
	<%= content_tag(:label, radio_button_tag('format', "Stylesheet", false) + " #{as_('Stylesheet')}") %>
  </div>
</div>
<div class="separator"></div>
  Seleziona: | <%= link_to_function as_(:all), '$$("div.columns input").each(function(input){input.checked=true})' %>
  | <%= link_to_function as_(:none), '$$("div.columns input").each(function(input){input.checked=false})' %>
  |
  
<div class="separator"></div>
  <%= submit_tag as_(:export), :class => "submit" %>
  <%= link_to as_(:cancel), params_for(:action => 'list'), :class => 'cancel' %>
  <%= loading_indicator_tag(:action => :export) %>
</form>
